Skip to content

Conversation

@dnhatn
Copy link
Member

@dnhatn dnhatn commented Feb 19, 2025

We have two leaks reported in breaker tests, but we do not have their traces. This PR integrates MockBlockFactory for breaker tests to help identify these potential leaks.

Relates #122810

@dnhatn dnhatn added v8.19.0 :Analytics/ES|QL AKA ESQL v9.0.1 >non-issue auto-backport Automatically create backport pull requests when merged and removed v9.0.1 labels Feb 20, 2025
@dnhatn dnhatn requested review from ivancea and nik9000 February 20, 2025 06:00
@dnhatn dnhatn marked this pull request as ready for review February 20, 2025 06:00
@elasticsearchmachine elasticsearchmachine added the Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) label Feb 20, 2025
@elasticsearchmachine
Copy link
Collaborator

Pinging @elastic/es-analytical-engine (Team:Analytics)


public static class EsqlTestPluginWithMockBlockFactory extends EsqlPlugin {
@Override
protected BlockFactoryProvider blockFactoryProvider(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can't we do this same thing, but injecting the MockBlockFactory directly without the need of the extra "Provider" layer? From what I see, the BlockFactory is already being injected, so just injecting the mock should be enough? Maybe with this same blockFactoryProvider() override.

It's a "Supplier of Factories", which is a bit :hehe:. If it's absolutely needed, no problem with it. But if we can avoid it... At least I'm not seeing what does it give us exactly 👀

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sadly, we can't inject a MockBlockFactory for a BlockFactory as it requires exact class names. I tried an alternative that avoids injecting BlockFactory by passing the ExchangeService, but it's less natural than this approach.

@dnhatn dnhatn requested a review from ivancea February 20, 2025 15:51
Copy link
Contributor

@ivancea ivancea left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good. I don't like having this factory provider, but I guess we don't have a better way until the dependency injections allows that

@dnhatn
Copy link
Member Author

dnhatn commented Feb 25, 2025

Thanks @ivancea.

@dnhatn dnhatn merged commit c02b484 into elastic:main Feb 25, 2025
17 checks passed
@dnhatn dnhatn deleted the mock-block-factory branch February 25, 2025 15:59
@dnhatn
Copy link
Member Author

dnhatn commented Feb 26, 2025

💚 All backports created successfully

Status Branch Result
8.x

Questions ?

Please refer to the Backport tool documentation

@elastic elastic deleted a comment from elasticsearchmachine Feb 26, 2025
elasticsearchmachine pushed a commit that referenced this pull request Feb 26, 2025
We have two leaks reported in breaker tests, but we do not have their
traces. This PR integrates MockBlockFactory for breaker tests to help
identify these potential leaks.

Relates #122810

(cherry picked from commit c02b484)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

:Analytics/ES|QL AKA ESQL auto-backport Automatically create backport pull requests when merged >non-issue Team:Analytics Meta label for analytical engine team (ESQL/Aggs/Geo) v8.19.0 v9.1.0

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants